home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr26
/
netprog.zip
/
NETPROG.TAR
/
ipc
/
getpwd.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-17
|
299b
|
21 lines
#include <stdio.h>
#define MAXLINE 255
main()
{
FILE *fp;
char line[MAXLINE];
if ( (fp = popen("/bin/pwd", "r")) == NULL)
err_sys("popen error");
if (fgets(line, MAXLINE, fp) == NULL)
err_sys("fgets error");
printf("%s", line); /* pwd inserts the newline */
pclose(fp);
exit(0);
}